<?php
/**
 * @Author: wang
 * @Date:   2017-03-30 21:10:11
 * @Last Modified by:   wang
 * @Last Modified time: 2017-03-30 23:32:19
 */
namespace frontend\modules\controllers;
use Yii;
use yii\web\Controller;
use frontend\models\Category;
use yii\data\Pagination;

class CategoryController extends Controller{

	public function actionList(){
		$this->layout = 'layout';
		return $this->render("cates");
	}

	public function actionAdd(){
		$this->layout = 'layout';
		$models = new Category();
		$list = $models->getOption();
		if(yii::$app->request->isPost){
			$data = yii::$app->request->post();
			if($models->add($data)){
				yii::$app->session->setFlash('info','添加成功');
			}
		}
		return $this->render("add",['list'=>$list,'model'=>$models]);

	}


}